Abstract
This project is all about applications of SLR to real data using RDr. Wayne Stewart
Here you should introduce the data and the problem you wish to solve. Use your own subheadings. Fill with informative sentences and pictures and links. You may inclucde sub-sub headings. You can cite from your bibliography (see Millar 2011 and Crawley (2012))
The data was collected here:
data(mtcars)
library(DT)
## Warning: package 'DT' was built under R version 3.5.1
datatable(
mtcars,filter = 'top', options = list(
pageLength = 5, autoWidth = TRUE, editable = TRUE, dom = 'Bfrtip',
buttons = c('copy', 'csv', 'excel', 'pdf', 'print')),
caption = htmltools::tags$caption(
style = 'caption-side: bottom; text-align: center;',
'Table 2: ', htmltools::em('This is a simple caption for the table.')
)
) %>%
formatStyle('mpg', color = 'red', backgroundColor = 'orange', fontWeight = 'bold')
library(crosstalk)
## Warning: package 'crosstalk' was built under R version 3.5.1
library(leaflet)
library(DT)
# Wrap data frame in SharedData
sd <- SharedData$new(quakes[sample(nrow(quakes), 100),])
# Create a filter input
filter_slider("mag", "Magnitude", sd, column=~mag, step=0.1, width=250)
# Use SharedData like a dataframe with Crosstalk-enabled widgets
bscols(
leaflet(sd) %>% addTiles() %>% addMarkers(),
datatable(sd, extensions="Scroller", style="bootstrap", class="compact", width="100%",
options=list(deferRender=TRUE, scrollY=300, scroller=TRUE))
)
## Assuming "long" and "lat" are longitude and latitude, respectively
#devtools::install_github("jcheng5/d3scatter")
library(d3scatter)
shared_mtcars <- SharedData$new(mtcars)
bscols(widths = c(3,NA,NA),
list(
filter_checkbox("cyl", "Cylinders", shared_mtcars, ~cyl, inline = TRUE),
filter_slider("hp", "Horsepower", shared_mtcars, ~hp, width = "100%"),
filter_select("auto", "Automatic", shared_mtcars, ~ifelse(am == 0, "Yes", "No"))
),
d3scatter(shared_mtcars, ~wt, ~mpg, ~factor(cyl), width="100%", height=250),
d3scatter(shared_mtcars, ~hp, ~qsec, ~factor(cyl), width="100%", height=250)
)
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 3.5.1
g = ggplot(mtcars, aes(x = disp, y = mpg, color = cyl)) + geom_point()
g = g + geom_smooth(method = "loess")
g
Graph of data with loess smoother
The following function was taken from https://rpubs.com/therimalaya/43190
\[\epsilon_i \sim N(0,\sigma^2)\]
\[R_{adj}^2 =\]
predict()ciReg()Remember to interpret this plot and all other plots
Crawley, Michael J. 2012. “Regression.” In The R Book, 449–97. Chichester, UK: John Wiley & Sons, Ltd.
Millar, Russell B. 2011. “Latent Variable Models.” In Statistics in Practice, 202–32. Chichester, UK: John Wiley & Sons, Ltd.